package com.bwie.controller;

import com.bwie.service.IUserService;
import com.bwie.service.TbCourseService;
import com.bwie.utils.R;
import com.bwie.vo.LoginInfoVo;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/course/index")
public class IndexController {
    @Autowired
    TbCourseService tbCourseService;
    @Autowired
    IUserService iUserService;

    /**
     * 测试熔断接口
     * @param loginInfoVo
     * @return
     */
    @PostMapping("/login")
    public R login(@RequestBody LoginInfoVo loginInfoVo){
        return iUserService.login(loginInfoVo);
    }

    /**
     * 分页获取课程信息
     * @return
     */
    @PostMapping("/getCourseList")
    public R getCourseList(@RequestBody PageInfoVo pageInfoVo){
            return tbCourseService.getCourseList(pageInfoVo);
    }
}
